/*  */
Vue.component("zz-nav-bar", {
    template: `<div class="zz-nav-bar zz-df zz-df-ai-c">
        <div class="nav-bar-item">
            <span>当前位置:</span>
            <span class="nav-bar-item_separator"></span>
        </div>
        <div 
            v-for="(item,index) in navData"
            :key="index"
            class="nav-bar-item">
            <span 
                class="nav-bar-item_name"
                @click.stop="changePath(item,index)">{{item[title]}}</span>
            <span class="nav-bar-item_separator">/</span>
        </div>
    </div>`,
    props:{
        // 数据
        navData:{
            type:Array,
            default(){
                return []
            }
        },
        // 名称
        title:{
            type:String,
            default:"title"
        }
    },

    data(){
        return {};
    },

    methods:{
        // 切换链接
        changePath(info,index){
            console.log("---changePath___info---",info);
            if(window.zzSideBarObj){
                var path = info[zzSideBarObj.settings.tabName];
                if(path&&index!=this.navData.length - 1){
                    //
                    this.$emit(
                        "getnavbardata",
                        zzSideBarObj.getMatchedItemsByIndex(zzSideBarObj.openNavMenu(path))
                    );
                    //
                    zzSideBarObj.refreshLocationHref(path);
                }
            }
        }
    }

});
/*  */